<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('订单电费列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input type="hidden" name="orderNo" th:value="${orderNo}"/>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="biz:orderitem:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="biz:orderitem:export">
                    <i class="fa fa-download"></i> 导出
                </a>
                <a class="btn btn-warning" onclick="closeItem()">
                    <i class="fa fa-reply-all"></i> 返回
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: bootstrap-table-fixed-columns-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('biz:orderitem:edit')}]];
        var removeFlag = [[${@permission.hasPermi('biz:orderitem:remove')}]];
        var idDatas = [[${@dict.getType('${column.dictType}')}]];
        var createTimeDatas = [[${@dict.getType('${column.dictType}')}]];
        var prefix = ctx + "biz/orderitem";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                fixedColumns: true,
                fixedRightNumber: 1,
                sortName: "id",
                sortOrder: "desc",
                modalName: "订单电费",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'tenantId',
                    title: '租户标识',
                    visible: false,
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'customerId',
                    title: '客户ID',
                    visible: false,
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'orderNo',
                    title: '订单号',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'deviceSn',
                    title: '设备编号',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'devicePort',
                    title: '端口口',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'goodsType',
                    title: '电费类型',
                    visible: false,
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'goodsId',
                    title: '电费id',
                    visible: false,
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'goodsName',
                    title: '电费名称',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'goodsDiagram',
                    title: '电费图片',
                    formatter: function (value, row, index) {
                        return $.table.imageView(value, 500, 500);
                    }
                },
                {
                    field: 'goodsNum',
                    title: '电费数量',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'goodsPrice',
                    title: '电费单价(元)',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'goodsCalcPrice',
                    title: '结算单价(元)',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    field: 'remark',
                    title: '备注',
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value, 10, 'open');
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a style="margin-top: 3px;" class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-info"></i> 详情</a> ');
                        actions.push('<a style="margin-top: 3px;" class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i> 删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function detail(id) {
            var url = prefix + '/detail/' + id + "?time=" + (new Date()).getTime();
            $.modal.openTab("订单电费详情", url);
        }
    </script>
</body>
</html>